package org.kumas.bigdata.hdfs3.ha;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.kumas.bigdata.hdfs3.constant.Constant;
import org.kumas.bigdata.hdfs3.protocol.HAServiceProtocol;
import org.kumas.bigdata.hdfs3.rpc.RegInfo;

import java.io.IOException;
import java.net.InetSocketAddress;

/*************************************************
 * TODO_Kumas
 *  Author： KumasZhang
 *  DateTime： 2021-12-05 9:50
 *  Description： 
 **/
public class FsSlaver {

    public static void main(String[] args) throws IOException, InterruptedException {
        HAServiceProtocol haService = RPC.getProxy(HAServiceProtocol.class, HAServiceProtocol.versionID,
                new InetSocketAddress(Constant.RPC_SERVER_ADDR, Constant.RPC_SERVER_HA_PORT), new Configuration());

        haService.registerInfo(new RegInfo("node1", 4, 16));

        while (true) {
            System.out.println(haService.heartbeat("node1", "我还活着。。。。。。"));
            Thread.sleep(3000);
        }
    }
}
